package com.zstu.mall.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.zstu.mall.common.BaseEntity;
import org.springframework.transaction.annotation.Transactional;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author     : wuyc
 * @description: product
 * @date       : Created in 2019/11/24
 */
@Entity
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Table(name = "product")
public class Product extends BaseEntity implements Serializable {

	/**
	 * null
	 * default value: ' '
	 */
	@Column(name = "title", nullable = false,length = 255)
	private String title;

	/**
	 * null
	 * default value: ' '
	 */
	@Column(name = "name", nullable = false,length = 255)
	private String name;

	/**
	 * 商品类别,多类别用逗号隔开
	 * default value: '0'
	 */
	@Column(name = "type", nullable = false,length = 255)
	private String type;

	/**
	 * 商品活动,多活动用逗号隔开
	 * default value: '0'
	 */
	@Column(name = "activity_id", nullable = false,length = 255)
	private String activityId;

	/**
	 * shop_id	varchar	255	0	0	0	0	0	0	' '	0	所属店铺	utf8	utf8_general_ci		0	0价格
	 * default value: 0
	 */
	@Column(name = "price", nullable = false,length = 50)
	private Double price;

	/**
	 * 库存
	 * default value: 0
	 */
	@Column(name = "store", nullable = false,length = 50)
	private Double store;

	/**
	 * 销量
	 * default value: 0
	 */
	@Column(name = "sales", nullable = false,length = 50)
	private Double sales;

	/**
	 * 所属店铺
	 * default value: ' '
	 */
	@Column(name = "shop_id", nullable = false,length = 255)
	private String shopId;

	/**
	 * 主图,多图片逗号分隔(命名方式:唯一编码)
	 * default value: 'error.png'
	 */
	@Column(name = "main_image", nullable = false,length = 255)
	private String mainImage;

	/**
	 * 多图片逗号分隔
	 * default value: 'error.png'
	 */
	@Column(name = "image", nullable = false,length = 255)
	private String image;

	/**
	 * 评论
	 * default value: ' '
	 */
	@Column(name = "content", nullable = false,length = 255)
	private String content;

	/**
	 * 评论
	 * default value: ' '
			*/
	@Column(name = "commont", nullable = false,length = 255)
	private String commont;

	/**
	 * 备用
	 * default value: ' '
	 */
	@Column(name = "string1", nullable = false,length = 255)
	private String string1;

	/**
	 * 备用
	 * default value: ' '
	 */
	@Column(name = "string2", nullable = false,length = 255)
	private String string2;

	/**
	 * 备用
	 * default value: ' '
	 */
	@Column(name = "string3", nullable = false,length = 255)
	private String string3;

	//其它表
	@Transient
	private ProductClass productClass;

	@Transient
	private List<ProductActivity> productActivitys;

	@Transient
	private List<String> images;

	public List<String> getImages() {
		return images;
	}

	public void setImages(List<String> images) {
		this.images = images;
	}

	public ProductClass getProductClass() {
		return productClass;
	}

	public void setProductClass(ProductClass productClass) {
		this.productClass = productClass;
	}

	public List<ProductActivity> getProductActivitys() {
		return productActivitys;
	}

	public void setProductActivitys(List<ProductActivity> productActivitys) {
		this.productActivitys = productActivitys;
	}

	public Product() {
		super();
		super.status = "1";
		super.remark = " ";
		super.gmtCreate = new Date();
		super.gmtModified = new Date();
		this.title = " ";
		this.name = " ";
		this.type = "0";
		this.activityId = "0";
		this.price = 0.0;
		this.store = 0.0;
		this.sales = 0.0;
		this.shopId = " ";
		this.mainImage = "error.png";
		this.image = "error.png";
		this.content = " ";
		this.commont = " ";
		this.string1 = "1";
		this.string2 = " ";
		this.string3 = " ";
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getType() {
		return this.type;
	}
	
	public void setType(String type) {
		this.type = type;
	}

	public String getActivityId() {
		return activityId;
	}

	public void setActivityId(String activityId) {
		this.activityId = activityId;
	}

	public Double getPrice() {
		return this.price;
	}
	
	public void setPrice(Double price) {
		this.price = price;
	}
	
	public Double getStore() {
		return this.store;
	}
	
	public void setStore(Double store) {
		this.store = store;
	}
	
	public Double getSales() {
		return this.sales;
	}
	
	public void setSales(Double sales) {
		this.sales = sales;
	}
	
	public String getShopId() {
		return this.shopId;
	}
	
	public void setShopId(String shopId) {
		this.shopId = shopId;
	}
	
	public String getMainImage() {
		return this.mainImage;
	}
	
	public void setMainImage(String mainImage) {
		this.mainImage = mainImage;
	}
	
	public String getImage() {
		return this.image;
	}
	
	public void setImage(String image) {
		this.image = image;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getCommont() {
		return commont;
	}

	public void setCommont(String commont) {
		this.commont = commont;
	}

	public String getString1() {
		return this.string1;
	}
	
	public void setString1(String string1) {
		this.string1 = string1;
	}
	
	public String getString2() {
		return this.string2;
	}
	
	public void setString2(String string2) {
		this.string2 = string2;
	}
	
	public String getString3() {
		return this.string3;
	}
	
	public void setString3(String string3) {
		this.string3 = string3;
	}

	@Override
	public String toString() {
		return "Product{" +
				"title='" + title + '\'' +
				", name='" + name + '\'' +
				", type='" + type + '\'' +
				", activityId='" + activityId + '\'' +
				", price=" + price +
				", store=" + store +
				", sales=" + sales +
				", shopId='" + shopId + '\'' +
				", mainImage='" + mainImage + '\'' +
				", image='" + image + '\'' +
				", content='" + content + '\'' +
				", commont='" + commont + '\'' +
				", string1='" + string1 + '\'' +
				", string2='" + string2 + '\'' +
				", string3='" + string3 + '\'' +
				", productClass=" + productClass +
				", productActivitys=" + productActivitys +
				", images=" + images +
				", id='" + id + '\'' +
				", gmtCreate=" + gmtCreate +
				", gmtModified=" + gmtModified +
				", status='" + status + '\'' +
				", remark='" + remark + '\'' +
				'}';
	}

}
